<?php
include_once('common/header.php');	
if($AppUI->id < 0) {
	Vfriend_Function::redirect(HOST_VFRIEND);
}	
$strEmail 	= $objRequest->getParam('piemail', '');
$validator 	= new Zend_Validate_EmailAddress();
$intError	= 0;
if($strEmail == "")
	$intError = 19;
elseif ($strEmail != "" && !$validator->isValid($strEmail))
	$intError = 20;
if($intError == 0) {
	$strSubject		= INDEX_INVITE_SUB;
	$this->view->strEmail	= $strEmail;
	$objView 		= Zend_Registry::get('objView'); 
	$strContent 	= $objView->fetch('email/invite.tpl');
	$objMail		= new Vfriend_Mail();
	$intSend		= $objMail->send(EMAIL_NOREPLY, EMAIL_NOREPLY_NAME, $strEmail, $strSubject, $strContent);
	if(!$intSend) {
		$intError	= 3;
	} else {
		Vfriend_Function::setMsg($arrMessage[4]);
	}	
}
if($intError > 0) {	
	Vfriend_Function::setError($arrError[$intError]);
}
Vfriend_Function::redirect(HOST_VFRIEND);	
?>